package cn.itcast.p2p20.bean.request;

import android.content.Context;

import java.util.HashMap;
import java.util.Map;

import cn.itcast.p2p20.bean.UserBean;
import cn.itcast.p2p20.net.BaseRequest;
import cn.itcast.p2p20.utils.Constant;
import cn.itcast.p2p20.utils.Util;

/**
 * Created by Administrator on 2016/7/31.
 */
public class QueryRequest implements BaseRequest {

    private Context mContext;
    private String type;

    public QueryRequest(Context context, String type) {
        this.mContext = context;
        this.type = type;
    }

    //type=assets

    @Override
    public String getUrl() {

        return Constant.format("SafeAccountQueryServlet");
    }

    @Override
    public HttpMethod getHttpMethod() {
        return HttpMethod.POST;
    }

    @Override
    public Map<String, String> getParams() {

        HashMap<String, String> map = new HashMap<>();
        map.put("type", type);
        UserBean userInfo = Util.getUserInfo(mContext);
        if (userInfo!=null) {

            map.put("username", userInfo.getUsername());
            map.put("token", userInfo.getToken());
        }


        return map;
    }
}
